package com.lc.afbx.dialog;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lc.afbx.BaseApplication;
import com.lc.afbx.R;

/**
 * Created by Administrator on 2016/4/5.
 */
public abstract class AlertDialog extends BaseDialog {

    public AlertDialog(Context context, String message) {

        super(context);

        setContentView(R.layout.dialog_alert);

        BaseApplication.ScaleScreenHelper.loadView((ViewGroup) findViewById(R.id.dialog));


        ((TextView) findViewById(R.id.alert_message)).setText(message);

        View.OnClickListener listener = new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                switch (v.getId()) {

                    case R.id.alert_confirm:

                        onConfirm();

                        break;
                    case R.id.alert_cancel:

                        onCancle();

                        break;

                }

                dismiss();

            }

        };


        findViewById(R.id.alert_cancel).setOnClickListener(listener);
        findViewById(R.id.alert_confirm).setOnClickListener(listener);


    }


    protected abstract void onConfirm();

    protected abstract void onCancle();


}
